package com.handshake.controller;

import com.handshake.entity.VolunteerActivitiesEntity;
import com.handshake.service.VolunteerActivitiesService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;


/**
 * 志愿者活动表
 *
 * @author LcLee Tankiland@outlook.com
 * @since 1.0.0 2024-10-09
 */
@RestController
@RequestMapping("volunteeractivities")
@Tag(name="志愿者活动表")
public class VolunteerActivitiesController {
    @Autowired
    private VolunteerActivitiesService volunteerActivitiesService;
    @GetMapping("/{id}")
    public VolunteerActivitiesEntity getvolunteerActivities(@PathVariable Long id) {
        return volunteerActivitiesService.getById(id);
    }
    //获取用户列表
    @GetMapping("/list")
    public List<VolunteerActivitiesEntity> listVolunteerActivities() {
        return volunteerActivitiesService.list();
    }
    //新增用户
    @PostMapping("/add")
    public void addVolunteerActivities(@RequestBody VolunteerActivitiesEntity volunteerActivities) {
            volunteerActivitiesService.save(volunteerActivities);
    }
    //更新用户
    @PutMapping("/update")
    public void updateVolunteerActivities(@RequestBody VolunteerActivitiesEntity volunteerActivities) {
            volunteerActivitiesService.updateById(volunteerActivities);
    }
    //删除用户
    @DeleteMapping("/{id}")
    public void deleteVolunteerActivities(@PathVariable Long id) {
            volunteerActivitiesService.removeById(id);
    }

}
